/**
 * @(#)UserType.java, 2018/2/2.
 * <p/>
 * Copyright 2018 Kerr Wang, Inc. All rights reserved.
 * KERRWANG PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package org.wangzx.exercise.enums;

/**
 * @author hzwangzuxiang(ahscwzx@163.com)
 */
public enum UserType implements EnumIntegerInterface<UserType>{
    BUYER(1, "买家"),
    SELLER(2, "卖家"),
    ;

    /**
     * 值
     */
    private final int value;

    /**
     * 描述
     */
    private final String desc;

    UserType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public int getValue() {
        return value;
    }

    @Override
    public UserType genEnumByIntValue(int intValue) {
        for (UserType item: UserType.values()) {
            if (item.value == intValue)
                return item;
        }
        return BUYER;
    }

    public String getDesc() {
        return desc;
    }
}
